/* COPYRIGHT-ENEA-SRC-R2 *
 **************************************************************************
 * Copyright (C) 2004-2006 by Enea Software AB.
 * All rights reserved.
 *
 * This Software is furnished under a software license agreement and
 * may be used only in accordance with the terms of such agreement.
 * Any other use or reproduction is prohibited. No title to and
 * ownership of the Software is hereby transferred.
 *
 * PROPRIETARY NOTICE
 * This Software consists of confidential information.
 * Trade secret law and copyright law protect this Software.
 * The above notice of copyright on this Software does not indicate
 * any actual or intended publication of such Software.
 **************************************************************************
 * COPYRIGHT-END */
/**
 * @public
 * @toc OSE:
 * @file osetypes.h
 *
 * @brief OSE basic type definitions.
 */

#ifndef _OSETYPES_H
#define _OSETYPES_H

/*
 * OSE type macros, mainly for internal use.
 */
#define MOV64(dest, src) (dest).lsw = (src).lsw, (dest).msw = (src).msw
#define EQU64(x, y)  ((x).lsw == (y).lsw && (x).msw == (y).msw)
#define NEQ64(x, y)  ((x).lsw != (y).lsw || (x).msw != (y).msw)
#define MAKEU64(dest, mswMA, lswMA) (dest).msw = (mswMA), (dest).lsw = (lswMA)
#define GETU32MSW(l) ((l).msw)
#define GETU32LSW(l) ((l).lsw)

/**
 * @type U32
 * 
 * @brief OSE unsigned 32-bit type
 *
 */
typedef unsigned long int U32;

/**
 * @type U16
 * 
 * @brief OSE unsigned 16-bit type
 *
 */
typedef unsigned short int U16;

/**
 * @type U8
 * 
 * @brief OSE unsigned 8-bit type
 *
 */
typedef unsigned char U8;

/**
 * @type S32
 * 
 * @brief OSE signed 32-bit type
 *
 */
typedef long int S32;

/**
 * @type S16
 * 
 * @brief OSE signed 16-bit type
 *
 */
typedef short int S16;

/**
 * @type S8
 * 
 * @brief OSE signed 8-bit type
 *
 */
typedef signed char S8;

/**
 * @type U64
 * 
 * @brief OSE unsigned 64-bit type
 *
 * @long Not compatible with a little endian 64 bit (long long) type, which
 *       is only a problem if you mix U64 and long long.
 *
 * @field msw Most significant 32-bit word.
 *
 * @field lsw Least significant 32-bit word.
 *
 */
typedef struct { U32 msw, lsw; } U64;

/**
 * @type Boolean
 *
 * @brief OSE boolean type
 *
 * @long Don't use enums/Boolean in signal definitions, they might not be
 *       compatible between different compilers/CPU's. Use an explicit U32
 *       instead.
 *
 * @field False (0)
 *
 * @field True (1)
 * 
 */
typedef enum { False = 0, True = 1 } Boolean;
typedef int BOOL;
typedef unsigned int UINT;

#endif
